<html>
<head>
    <script type="text/javascript" src="Lib/Moshu.js"></script>
    <script type="text/javascript" src="Lib/2D/Moshu.Canvas2D.js"></script>
</head>


<body>
   

    <canvas id="c"  width="500" height="500" border="1" style="border:1px solid black"></canvas>

    <br/>
    <script type="text/javascript">
        var scene = new Moshu.Canvas2D.Scene("c");
        var test1 = false;
        var test2 = true;
        if (test1) {
            var bottomBoundary = new Moshu.Canvas2D.Rectangle(0, scene.canvas.height - 50, scene.canvas.width, 50);
            bottomBoundary.fixed = true;
            scene.add(bottomBoundary);

            var img = new Moshu.Canvas2D.CanvasImage(100, 100, 50, 50, "./vs3.0/images/img1.png");
            img.acceleration.ay = 20;
            scene.add(img);

            var line = new Moshu.Canvas2D.Line(200, 200, 50, 50);
            line.acceleration.ay = 20;
            scene.add(line);

            img.bind("moved", function (args) {
                //console.log(args.target.collisions.length);

            });
        }
        
        if (test2) {
            var triangle = new Moshu.Canvas2D.Triangle(50, 300, 50, 450, 450, 450);
            scene.add(triangle);

            var rect = new Moshu.Canvas2D.Rectangle(300, 100, 50, 50);
            rect.fill.enabled = true;
            rect.fill.color = "blue";
            rect.velocity.dy = 100;
            rect.bind("moved", function (args) {
                if (args.target.collisions.length > 0)
                    rect.fill.color = "red";
                else rect.fill.color = "blue";
                //console.log(args.target.collisions.length);
            });
            scene.add(rect);
        }

        scene.update();        
    </script>
</body>

</html>
